<template>
  <button @click="toggle">显示</button>
  <h1>{{ count }}</h1>
  <ModalView @sendNum="sendNumHandler" v-model="visible" />
</template>

<script>
import ModalView from "./ModalView";
export default {
  components: {
    ModalView,
  },
  data() {
    return {
      // 控制对话框组件的显示状态
      visible: false,
      count: 0,
    };
  },
  methods: {
    sendNumHandler(num) {
      this.count += num;
    },
    toggle() {
      this.visible = true;
    },
  },
};
</script>

<style>
</style>